<template>
  <el-input
      v-model="form.context"
      :rows="5"
      type="textarea"
      placeholder="请输入工作内容"
  />
  <el-button style="margin: .5rem 0" type="primary" @click="xmlBtnClick">解析</el-button>
  <el-input
      v-model="form.result"
      :rows="5"
      disabled
      type="textarea"
      placeholder=""
  />
</template>

<script>
import {ref,unref, getCurrentInstance, watch, reactive, onMounted} from "vue";
import {ElMessage, ElMessageBox} from 'element-plus';
import {useRouter} from "vue-router";

export default {
  name: "index",
  components:{

  },
  setup(props ,content){
    const router = useRouter()
    const {proxy} = getCurrentInstance();
    let data = {
      form: ref({}),
      loading: ref(false),
    }
    //监听
    watch(() => [props.info], ([newInfo],[oldInfo]) => {

    })
    onMounted(async () => {

    })
    let methods = {

      async xmlBtnClick() {
        let form = data.form.value;

        let str = ""
        if (form.context) {
          str = form.context
          let xml = proxy.$x2js.xml2js(form.context)
          str = JSON.stringify(xml)
        }
        data.form.value.result = str
      },

    }

    return {
      proxy,
      router,
      ...data,
      ...methods
    }
  }
}
</script>

<style lang="scss" scoped>

</style>